/**
 * 节点对象
 * @param uuid
 * @param uri
 * @param label
 * @param type
 * @param color
 * @param r
 * @constructor
 */
export function Node(uuid, uri, label, type,color,r) {
  this.uuid = uuid;
  this.uri = uri;
  this.label = label;
  this.type = type; //指向typeList中特定类型对象
  this.typeId = type.id;

  this.color = color;
  this.r = r;
  // this.selfColor =null; //自定义节点颜色-undefined
}

/**----------------------------------------------------------------------------- */
/** 字体、颜色等属性计算函数 */
export function fontSize(d) {
  let font_size = d.r * 3 / (d.label.length * 1.5);
  if(d.label.length <= 2) font_size -= d.label.length * 4;
  font_size = font_size > d.r ? d.r : font_size;
  return font_size;
}
export function fontWeight(d) {
  return Math.floor(900 / fontSize(d) + 500);
}
export function fontDy(d) {
  return String(0.3*fontSize(d));
}